home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
ASSEMBLE
/
2743.ZIP
/
CPUSPEC3
< prev
next >
Wrap
Text File
|
1980-01-01
|
5KB
|
118 lines
'COMPUTER' SPECIFICATION
------------------------
This is a program that runs on IBM PC compatible
computers, simulating a simple microprocessor, showing
data flows around the registers and 'bus' systems.
The CPU has
two data registers (A and B),
program counter PC,
instruction register IR,
two temporary data registers T1 and T2
used for ALU operations,
address register AD used for direct addressing
and JMP instructions,
and stack pointer SP for CALL, PUSH and POP.
The computer uses 'micro-code' to perform its
operations. The user has a choice whether to display
these micro-steps. The program runs a little faster when
not displaying the micro-step text.
The instruction set and format have been chosen to be
similar to Intel format, to provide a 'stepping stone'
to the 'real thing'. Also, as well as Intel's MOV
mnemonic, Zilog's LD, BASIC's LET, and MOVE, MOVETO,
COPY, and COPYTO can be used for the users source code.
All except LET are translated to MOV before assembly
translation to machine code. LET produces a different
machine-code number but performs the same
micro-instruction steps as the corresponding MOV.
All operation codes, data and addresses are 8-bit,
limiting memory to 256 bytes. Not many of my students'
programs have exceeded this, so should be adequate for
the intended application. Input and output ports read
from, and write to, variables, some of which are
predefined, so effectively provide another 150 or so
locations which can be used for a users data.
The program enables the level of complexity to be
chosen, as detailed under COMPLEXITY LEVELS.
Model I/O addresses 0 to $F ($ indicates hex) can be
assigned to real i/o ports. The 'screen' is I/O mapped
or can be written to as a normal screen which scrolls
when necessary. Details are under Input and Output Port
Definitions.
Debug allows control of the 'microprocessor' in a
way similar to MicroSoft's Debug.
This would be useful for many schools and colleges
having IBM PC compatible machines, but wanting to teach
simplified assembler programming. This may be adequate
for all of the assembler programming of a first-year,
part time course (one BTEC unit).
The work consists of
(1) CPU24.EXE model computer program
(2) ASM13.EXE assembler program to produce machine
code from assembler mnemonics.
(3) OPCODESC.CPU used by both (1) and (2) which has
(a) text for microcode steps (preceded by !)
and (b) a list of opcodes and corresponding
microcode steps. (The first character in
the microcode list is used by the
assembler.)
(4) a number of machine-code object programs (*.mc)
assembled from source programs (*.asm).
The CPU program reads machine codes in ASCII hex format
which could be produced using any text editor. This
simplifies the direct production of a machine-code
program if a teacher wished to set this as a student
task before using the assembler. It also means that the
assembler need only produce one output file, which
serves as both a machine-code file and as a list file,
reporting memory locations used, content, and source
code.
The CPU program looks for pairs of hex digits (starting
at the fourth character position on a line, to enable
the assembler to list memory locations used) separated
by spaces or commas, and abandons the line when any
non-legal character is encountered (including a
semi-colon indicating comment at any of the first four
characters of the line).
A teacher may wish to set a machine-code program as an
initial exercise. To simplify this, an assembler ORG
pseudo-operation is implemented by an asterisk ('*') as
the first character on a line, followed immediately by a
pair of hex digits. This sets the memory address
counter, and causes data to be loaded into memory from
location specified. This means that instead of
calculating address for subroutines precisely, a rough
count can be made, then add a few and set subroutine
address with asterisk, so that calculations do not need
to be exact, and can allow minor program modifications
without changing subroutine locations. ORG is of
doubtful value when using the assembler.
Debug commands change the content of registers or memory
locations from the screen, for debugging, and to enable
a machine-code program to be entered directly as an
initial programming exercise. The 'computer' will
single-step or free-run to a breakpoint.
David Stonebanks, 171 Fairview Road, Stevenage, SG1 2NE
1 June 91